/* 8911106 302933981 Ofri Keidar */

/******************************************************************************
* Student Name: Ofri Keidar
* Exercise Name: Ex6
* File Description: Class Order's interface. An Order object holds the number
* 					of the ordered item, ordered amount and how many items
* 					should be received in order to complete order. Each order
* 					has a number, starts from 1 and continues with steps of 1
******************************************************************************/


#ifndef ORDER_H_
#define ORDER_H_
#include <iostream>
using namespace std;
#define INIT_AMOUNT 0 // used to initialize amount of item in stock

class Order {
private:
	const unsigned int m_orderNum; // order's number
	const short m_itemNum; // item number that is ordered
	const unsigned int m_amountOrdered; // amount of items that was ordered
	unsigned int m_amountLeft; // amount of items that is remained to be ordered

public:
	/***************************************************************************************
	* function name: Order(const Order& orderToCopy)
	* The Input: Order object to be copied
	* The output: None
	* The Function operation: Empty implementation since an order should not be copied
	***************************************************************************************/
	Order(const Order& orderToCopy);/*: m_orderNum(orderToCopy.m_orderNum), m_itemNum(orderToCopy.m_itemNum),
							         m_amountOrdered(orderToCopy.m_amountOrdered) { }*/

	/***************************************************************************************
	* function name: Order(const int orderNum, const short itemNum, const unsigned short amount)
	* The Input: Number of item to be ordered and amount to be ordered
	* The output: None
	* The Function operation: Creates a new order with given values
	***************************************************************************************/
	Order(const int orderNum, const short itemNum, const unsigned short amount);

	/***************************************************************************************
	* function name: ~Order()
	* The Input: None
	* The output: None
	* The Function operation: Destructs Order object. Empty implementation since Order's
	* 						  members are of primitive types
	***************************************************************************************/
	~Order() { }

	/***************************************************************************************
	* function name: void updateAmount(const unsigned short amountToDecrement)
	* The Input: Amount to decrement from order
	* The output: None
	* The Function operation: Decrements given amount from order's amount
	***************************************************************************************/
	void updateAmount(const unsigned short amountToDecrement) {m_amountLeft -= amountToDecrement;}

	/***************************************************************************************
	* function name: short getItemNumer() const
	* The Input: None
	* The output: Order's item number
	* The Function operation: Returns order's item number attribute. Method does not chagne
	* 						  the object
	***************************************************************************************/
	short getItemNumer() const {return m_itemNum;}

	/***************************************************************************************
	 * function name: friend ostream& operator << (ostream &os, const Order& orderToPrint)
	 * The Input: Reference to order to be printed
	 * The output: ostream reference
	 * The Function operation: Prints order's details in format [order-number, ordered-amount, receive-amount]
	 ***************************************************************************************/
	friend ostream& operator << (ostream &os, const Order& orderToPrint);
};


#endif
